package dormouse.fx.renderers;

import javafx.scene.Node;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

import org.apache.commons.vfs2.FileObject;

import dormouse.DormouseContext;
import dormouse.vfs.ui.renderers.IFileIconFactory;
import dormouse.vfs.ui.renderers.IFileRenderer;

public class IconRenderer extends ImageView implements IFileRenderer<Node> {
	
	private String[] exts = null;
	private IFileIconFactory<Image> iconFactory = null;
	
	public IconRenderer(){
		iconFactory = DormouseContext.getIconFactory();
		exts = iconFactory.getExtensions();
	}

	@Override
	public void render(FileObject file) {		
		setImage(iconFactory.getFileIcon(file));		
	}

	@Override
	public Node getComponent() {
		return this;
	}

	@Override
	public String[] getFileExtensions() {
		return exts;
	}



}
